home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / ODFDev / ODF / OS / FWGraphx / FWGC.h < prev    next >
Encoding:
Text File  |  1996-12-16  |  4.2 KB  |  158 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWGC.h
  4. //    Release Version:    $ ODF 3 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWGC_H
  11. #define FWGC_H
  12.  
  13. #ifndef SLGRDEF_H
  14. #include "SLGrDef.h"
  15. #endif
  16.  
  17. #ifndef SLGC_H
  18. #include "SLGC.h"
  19. #endif
  20.  
  21. #ifndef SLGDEV_H
  22. #include "SLGDev.h"
  23. #endif
  24.  
  25. #ifndef FWPOINT_H
  26. #include "FWPoint.h"
  27. #endif
  28.  
  29. #ifndef FWRECT_H
  30. #include "FWRect.h"
  31. #endif
  32.  
  33. #ifndef FWMAPING_H
  34. #include "FWMaping.h"
  35. #endif
  36.  
  37. // ----- Foundation Includes -----
  38.  
  39. #ifndef FWEXCLIB_H
  40. #include "FWExcLib.h"
  41. #endif
  42.  
  43. // ----- Platform Includes -----
  44.  
  45. #if defined(FW_BUILD_WIN) && !defined(_INC_WINDOWS)
  46. #include <windows.h>
  47. #endif
  48.  
  49. #if defined(FW_BUILD_WIN) && !defined(SOM_ODPlatformCanvas_xh)
  50. #include <PlatCanv.xh>
  51. #endif
  52.  
  53.  
  54. //========================================================================================
  55. //    Forward Declarations
  56. //========================================================================================
  57.  
  58. class    ODShape;
  59. class    ODCanvas;
  60. class    ODTransform;
  61.  
  62. struct    FW_SPrivSuspendResumeState;
  63.  
  64. //========================================================================================
  65. //    class FW_CGraphicContext
  66. //========================================================================================
  67.  
  68. class    FW_CGraphicContext : public FW_SGraphicContext
  69. {
  70. //----------------------------------------------------------------------------------------
  71. //    Constructors/Destructors
  72. //
  73. public:
  74.     FW_DECLARE_AUTO(FW_CGraphicContext)
  75.  
  76.     virtual ~FW_CGraphicContext();
  77.  
  78. protected:
  79.     FW_CGraphicContext(Environment* ev);
  80.     
  81.     // ----- Init Graphic Context with a transform
  82.     void    InitGraphicContext(FW_HGDevice graphicDevice,
  83.                                ODTransform* transform,
  84.                                ODShape* clipShape);
  85.                                 
  86.     // ----- Terminate the Graphic Context
  87.     void    TerminateGraphicContext();
  88.  
  89. //----------------------------------------------------------------------------------------
  90. //    New API
  91. //
  92. public:
  93.     // ----- Conversion -----
  94.     FW_CPlatformPoint        LogicalToDevice(FW_Fixed xSize, FW_Fixed ySize) const;
  95.     FW_CPlatformPoint        LogicalToDevice(const FW_CPoint& point) const;
  96.     FW_CPlatformRect        LogicalToDevice(const FW_CRect& rect) const;
  97.     ODShape*                LogicalToDevice(ODShape* shape) const;
  98.                                 
  99.     FW_CPoint                DeviceToLogical(FW_PlatformCoordinate xSize, FW_PlatformCoordinate ySize) const;
  100.     FW_CPoint                DeviceToLogical(const FW_CPlatformPoint& point) const;
  101.     FW_CRect                DeviceToLogical(const FW_CPlatformRect& rect) const;
  102.     ODShape*                DeviceToLogical(ODShape* region) const;
  103.  
  104.     // ----- Clipping -----
  105.     ODShape*                AcquireClip() const;                        // the resulting shape belongs to the caller
  106.     void                    SetClip(ODShape* odShape);                    // a copy of odShape is used
  107.     
  108.     void                    GetClipRect(FW_SRect& clipRect) const;
  109.     void                    SetClipRect(const FW_SRect& clipRect);
  110.  
  111.     // ----- Mapping -----
  112.     void                    SetMapping(const FW_SMapping& newMapping);
  113.     void                    GetMapping(FW_CMapping& mapping) const;
  114.  
  115.     virtual void            Reset() = 0;
  116.     
  117. protected:
  118.     void                    PrivReset(ODTransform* transform,
  119.                                     ODShape* clipShape);
  120.  
  121. //----------------------------------------------------------------------------------------
  122. //    Getters for members defined in FW_SGraphicContext
  123. //
  124. public:
  125.     FW_HGDevice                GetGraphicDevice() const    
  126.                                 { return fGraphicDevice; }
  127.  
  128.     FW_PlatformCanvas        GetPlatformCanvas() const
  129.                                 {     return FW_PrivGDev_GetPlatformCanvas(fGraphicDevice); }
  130.  
  131.     Environment*            GetEnvironment() const
  132.                                 { return fEnvironment; }
  133.  
  134. private:
  135.     FW_CGraphicContext(const FW_CGraphicContext& other);
  136.     FW_CGraphicContext& operator=(const FW_CGraphicContext& other);
  137.         // Copy constructor and assignment operator not valid for this class.    
  138. };
  139.  
  140. //========================================================================================
  141. //    class FW_CSaveRestoreContext
  142. //========================================================================================
  143.  
  144. class    FW_CSaveRestoreContext
  145. {
  146. public:
  147.     FW_DECLARE_AUTO(FW_CSaveRestoreContext)
  148.  
  149.     FW_CSaveRestoreContext(FW_CGraphicContext& gc);
  150.     virtual ~ FW_CSaveRestoreContext();
  151.  
  152. private:
  153.     FW_CGraphicContext&        fGC;
  154.     FW_SPrivSuspendResumeState*    fSuspendResume;
  155. };
  156.  
  157. #endif
  158.